<template>
  <div class="animal-item">
    <div class="mask">
    </div>
    <img :src="animal.imgUrl" :alt="animal.title">
    <h4>{{animal.title}}</h4>
    <p>{{animal.content}}</p>
    <a href="" class="go-detail">查看详情></a>
  </div>
</template>

<script>
export default {
  name: 'AnimalItem',
  props: {
    animal: Object
  }
}
</script>

<style scoped>
  .animal-item {
    position: relative;
    width: 250px;
    background-color: #F2F3FF;
    border-radius: 5px;
    margin: 30px 0 30px 30px;
    padding: 20px;
  }

  .mask {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 200px;
    height: 110px;
    border-radius: 10px;
    background: url('~assets/img/coverall.png') no-repeat -1px -195px;
    /* z-index: 2; */
    opacity: 1;
  }

  img {
    width: 200px;
    height: 110px;
    border-radius: 10px;
    margin-bottom: 10px;
  }

  h4 {
    text-align: center;
    margin-left: 5px;
    margin-bottom: 10px;
    /* 单行文本溢出隐藏 */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  p {
    font-size: 14px;
    line-height: 30px;
    margin-left: 5px;
    /* 多行文本溢出隐藏 */
    display: -webkit-box;
    word-break: break-all;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 5;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: pre-line;
  }

  .go-detail {
    display: inline-block;
    font-size: 12px;
    text-decoration: underline;
    margin-top: 15px;
    margin-left: 130px;
  }

  .go-detail:hover {
    color: #86a3b1;
  }
</style>